home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
dev
/
cross
/
sasmv14.dms
/
sasmv14.adf
/
manual.readme
< prev
next >
Wrap
Text File
|
1993-05-22
|
27KB
|
679 lines
SASM QuickManual © 1993 by Infernal Byte Systems, INC.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
< Welcome to the prelimary SASM V1.4 doxs >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WHAT'S NEW ?
------------
- Lots (!!!) of bugs removed.
- Can't imagine that it worked before...
- Only stupid kids swap lea 4(a5),a0 with move.l 4(a5),a0 but it worked ?!?
- Some includes added and updated.
- RESETHANDLER added. Now you're NOT forced to switch your Super
Famicom/Nintendo On/Off/On every new run anymore. You don't even
have to press the Reset button on it. Simple assemble with the
resethandler.i include file at the beginning of your code and create a
little wire from Amiga<>SNES.
- Lot's of errors from the snes doxs removed.
- Anybody an idea about the CMA instruction mentioned in the
Western Digital documents ?? Some other guys also create CPA but that
is not mentioned in the Western Digital documentation.
- Extensive Error Message Handling. Just over one hundert different error
and warning messages for clear reports. Not just 'RELATIVE MODE ERROR'
like some others.... :)
- Speed improved.
DISCLAIMER
----------
This software package is shareware. When you find it usfull and you're
working with it a lot, please feel free to send $50.00 to the authors
address. You will then get free updates, a full version of SASM (including
SPC700 assembly and a MC68000 version...) and a well done, binded TeX
manual. So don't be a foul and register. You'll find a registeration
sheet on the disk in the 'order' directory.
Since no programming author can guarantee that his software package is bug
free, you'll use this software package on your own risk. The authors are
not responsible in any form for anything that will happen during the use of
SASM. But overall we can say the product runs stable, it's deeply debugged
and tested. If you find any kind of bug, we would be pleased if you send
us a bugreport in. You'll find a bugreport sheet also on this disk, again
in the 'order' directory. Please attach sample sourcecode to reproduce the
bug. Every person who'll send a real bug, will be get some piece of my SNES
sourcecodes, just to make sure that i will receive the bug reports.
Florian W. Sauer
Hachumerstr. 48
3205 Bockenem 1
Germany <- thats the answer to bad english spelling :)
WHAT IS SASM ?
--------------
This one-pass assembler is designed to create really cool games running on
the S-NES system using the SuperMagicom or similar hardware. A lot of
commands have been installed to make live much easier. This is a cool
piece of software, its for cool dudes only, supporting includes, macros,
conditional assembly and much more. Also it uses latest software
technologies for top speed analyzing and creating code (yep, up to six
times faster than FAsm v0.52 using 3 MBYTE of rts).
Being more serious guys, saying that SASM is a conditional macro assembler,
which supports full WD65C816 command set, unlimited length of symbols,
unlimited number of symbols, unlimited sourcesize. Also it supports macro
processing being a macro-assembler, nestable include-file handling
(nestable up to 128 times), re-definable symbols, an interface via AREXX to
the CygnusEditor or similar, locally definable labels, SNES register help
pages, WD65C816 help pages, high-level-language like statements, relative
equations, userfriendly error messages, repeat statements, operator
precedence expression pharsing and (of course) speed. Overall SASM is able
to assemble upto 30.000 lines per second, however the LPS rate grows like
the size of the sourcefile grows. So SASM is much faster than anything
else known by the authors. The assembler is designed to work with the
Super Magicom hardware or something similar. Sending tools are included in
the package, ripped from the pirate scene, hope you don't mind, they are
great! Also a hardware debugger is avaible in the near future for the
Amiga series of computers.
Additional examples, sourcefiles, bonusprograms and tools are on the disk,
just try them out. Later in the manual the text refers to them.
INSTALLATION & REQUIERMENTS
---------------------------
You only will find the MC68030 version of the assembler on this disk. To
get a MC68000 version, please register and send your comments to the above
address. Also the MC68000 version is not as hungry as the '030 version is,
since it needs about one meg less. We strongly recommend to use the
MC68030 version of the assembler, since it is lots faster and anyone who
has enough memory to run SASM, has also a big motorola in his Amiga. The
author uses an Amiga 3000 with ten megabytes of RAM running at 25MHZ, which
is pretty nippy. Also the MC68000 uses dump-hashing which is NOT as
effective as the hashing method used in the MC68030 version.
SASM's speed requiers lots of memory. For all hashtables and lists the
assembler needs overall 1.2 megabytes of memory. So a minimum of two
megabytes have to be installed in your Amiga to assemble something.
Therefore you will really get fast output. Compare to anything else you
know. Don't get confused when you assemble small files and the statistic
reports low LPS rates. The assembler needs big sourcefiles to be fast.
The bottleneck of assembly is IO. Please ensure that this bottleneck is as
wide as possible, only assembling on a SCSI controlled harddrive and not on
floppy disk. If you havn't got a fast harddrive, we suggest to copy your
sourcefiles into RAM and assemble in the ramdisk. The floppy is toooo
slow.
So, now you know 8 megabyte RAM and a MC68030 will do best, but which
software do you need to work with SASM? Well, anything you will need is
included on this disk. Please install first a copy of SASM into your c:
directory, next copy the AREXX script files into your REXX: directory. To
link SASM with the CygnusEd, simply install the 'sasmrexx.ced' script file
into your CygnusEd and create a macro which saves the current buffers first
and involks the rexx-script afterwards. The script will assemble your file
and link the errormessages to the CygnusEd. The only thing missing now is
a '.project' file, which says to AREXX what file to work with. The
.project file is like:
snes:demo2/megasource.s
send
The first line is the full path of your current working file. If the
second line reads 'send', your executable SMC file is directly sended to
the Super Magicom after successfull assembly. If there is just a blank
line, nothing happens after assembly, but returning to CygnusEd.
To start editing your current project, simply type 'Rx edit' or only
'edit', if you are using something like CSH V5.17 or so. By the way, SASM
needs kickstart 2.04 or higher to work. Yep, I know, lots of things we
need, but why shouldn't i use it, when my A3000 supports them?
If you want to use the SEND/S option via the commandline, please install
'smc13' into your c: directory with the filename unchanged.
HOW DOES IT WORK?
-----------------
Good question! Some time ago, i had to ask myself, how can i realize a
good and quick assembler in MC68030, not being to difficult to code and
debug. After reading lots of books, i knew the basic ways. Assembling on
Amiga is quite simple, when you have enough memory. I suppose it is like
hell, porting this goodie to a PC. Never mind, after reading the complete
sourcefile into memory, we will directly start to assemble in one pass.
That means that all sucking forward references have to be chained and
processed later on. So don't get confused if some of your first lines of
code will read like the following:
start: exp= codesize*4
Where codesize is defined at the end of your sourcecode. The 'exp=' pseudo
opcode will just evaluate the following expression and print the result to
the console. Implemented only for debugging and found usfull. But whats
the problem? It is easy, don't suppose the expression result is the first
thing printed to the console, since codesize is a forward reference. So
the line is resolved at the end and consequently the result is printout
near to the end of assembly. Got it?
Too avoid long assembly delays everything which need to be expanded from
orginal sourcecode to whatever longer (like macros and local symbols), is
stored outside of the orginal memory buffer. That increases memory usage!
Don't forget it, when using lots of macros and local symbols.
WARNINGS & ERROR MESSAGES
-------------------------
Lets avoid them! This nagging bastards will try to help you getting your
code running. So there are four types of errors/warnings. The first one
DOSERROR is just an errormessage from AmigaDOS, god knows what went wrong.
The second, called WARNINGS are slightly more to notice. Something went
wrong, but that was not a reason to abort assembly. Don't throw'em away,
since it is to suppose you made an error! (Most of the time). You are
able to suspress warnings by adding 'NOWARN' to the commandline. Anyway,
when you do so, a coloured message will be print to console-output, if
there were warnings, since it is no good, really forget them all. Next
topic, the ASSEMBLY errors. Something serious has happen and needs cure.
Remember that, some small error will result in heavy error message, just
look only on the first and keep cool. The last type of errormessage is
called: RESOLVE. This will come up, if an error is found during resolving
the sucking forward references. Most of the time, it's a undefined symbol
or something like that. Easy going. Cure it and go! A little help is
included when working with include files. The current filename is printed
at the top of the errormessage appended by the current nest deep in decimal
number (just for showbiz).
Note that SASM is strictly producing warnings when he/she expects 8 or 16
or 24 bit data and you give him/her more bits... You can ignore most of those
warnings when you just initalize pointers with '<','>','^'....
CALCULATIONS
------------
Just to say, that all calculations done during assembly are signed 32-bit,
so don't get confused.
Valid operators are:
|| : bit OR
&& : bit AND
+ : addition
- : subtraction (also leading - for negative numbers)
* : multiply
/ : divide
^ : power of
<< : shift left
>> : shift right
() : brackets
They are listed in pri order. That means || has the lowest pri. Note:
This piece of code does NOT evaluate expressions like the Seka does. It
uses expression precendence pharsing to act like it should do, so 2+3*2
will be eight, not (like seka does) ten.
ACCU AND INDEX REGISTER SIZE TRACKING
-------------------------------------
Normally, the size of this both is initialized by 8 bit at the beginning
of assembly. Than all REP/SEP's are scanned and the assembler recognizes
them getting to know what to do.
Problem: So SASM recognizes my REP/SEP instructions, but what should SASM
~~~~~~~ do with 'PLP' instructions, since they also may change register
size ?
Answer: SASM does nothing. You have to use the MODE command to track your
~~~~~~ work. Remember MODE does NOT create any code!
Warning: One of the mostly done errors in your code WILL BE WRONG register
~~~~~~~ size at run time matching with bad code. I.e. running all in 8 bit
but SASM has generated 16 bit code. Refer good books about WD65C816
assembly language.
Hints: - Verify size after interrupt and subroutines.
~~~~~ - At start all regs are eight bit.
- Read the instrucions about the MODE command.
- Read WD65C816 documentation about REP/SEP, index & accu sizes.
Example: All your code uses 16 bits accu, but the VBI, it uses 8 bit ACCU.
~~~~~~~
Following code:
~~~~~~~~~~~~~~
<main routine> (16 bit) [call some subroutine in 16 bit mode]
.
.
<VBI routine> (here we switch to 8 bits)
.
.
<sub routines> (here we forget to switch back to 16 bits, using
MODE A16, since we don't need a REP, since during run-
time we are just in 16 bits, since we have been called
from <main routine>, but SASM generates 8 bit code,
since SASM can't better know.)
So the resolve of all this is:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<main routine> (16 bit) [call some subroutine in 16 bit mode]
.
.
<VBI routine> (here we switch to 8 bits)
.
.
MODE A16X16 (this makes the world ok!)
<sub routines> (16 bit runtime, 16 bit generated.)
What we know now: Don't get confused. This ain't no M68000 anymore...
~~~~~~~~~~~~~~~~ [& read the SPC700 dox' to get moreover confused... :)]
WESTERN DIGITAL SYNTAX
----------------------
Fully supported. That means:
after # a '<' will do nothing. (Getting LSB)
a '>' will shift to the right by 8 bits. (Getting Middle SB)
a '^' will shift to the right by 16 bits. (Getting MSB)
And using ABSOLUTE ADDRESSING:
a '<' forces to 8 bits.
a '!' or '|' forces to 16 bit. (also default in forward references)
a '>' forces to 24 bits.
Thats nearly silly and for hell needed. The syntax is not defined by me,
but the Western Digital. Refer to: ISBN 0-07-881235-6
The suggested alternative mnemonics are included aswell. Anyway, i have no idea
to handle with CMA, it should be an abbrev. for 'CMP A', but this one is really
wrecked.
LOCAL SYMBOLS
-------------
SASM supports local symbols to be used either in macro expanding and/or in
normal sourcecode. A local symbol has it is 'known' range between two
normal label definitions and/or macro calls. That means:
MyRoutine:
clc
bra .skip
dc.b 0,0,0,0
.skip nop
will work, but
MyRoutine2:
clc
bra .skip
dc.b 0,0,0,0
CLR_ALL_REGS ;call a macro
.skip nop
will not work, since a macro is called between definition and reference of the
local symbol. Also
MyRoutine3:
bra .skip
dc.b 0,0,0
.skip: nop
MyRoutine4:
bra .skip
dc.b 0,0,0
.skip: rts
will just work fine... Good'un! Please note that local symbols are internally
handled like: 'lll_<8 digits #><name>', so please do NOT use any symbols starting
with 'lll_', since this may cause confusion to SASM.
KNOWN BUGS
----------
Yep, there are some, but they are fixed in the full version, just for me to
get some money! :)
- MACRO calls, MACRO definition and Conditional Assembly MUST NOT start at
lines with local labels in. That will cause a crash. Simply use a complete
line for a locallabel with no other information.
- LIST Option included only in the full version.
MORE TO SAY ????
----------------
Okey dokey, not more to say. Look at the examples and try it out. When you
want a more complete package, including SNES demo sources, than register.
WHAT WILL HAPPEN IN THE FUTURE ?
--------------------------------
Some improvments have to be done and, i guess, lots of debugging. Also we
are just developing a hardware debugger for the SNES/AMIGA. So send in
bugreports. With sources s.v.p. SPC700 assembly will be included to
persons who register, when enough people will register...
GREETINGS
---------
Hi DAX, thanks for all your help. Your 3rd demo is quite nice. And you
words about the SNES scene: *HOW TRUE*
Hi Mystic Brain, good luck, hacking PC.
Hi Aragon, did you forgot the 'SEND GAME DATA' option, or i am just too
lazy?
Hi HBT and MR.MADNESS: Give me a call to discuss on assembler programming.
Hi Starr of Quartex: Hope you don't mind me including SMC13. Its the
fastest sending tool on Amiga i know.
Mr.Soundwave: Keep easy going.
LIST OF PSEUDO OPCODES
----------------------
Here's the complete list of all pseudo opcodes that SASM will understand.
If you have any more ideas, please let us know. At the moment there are 42
valid opcodes. Make sure that you read the HEAP command syntax. It's the
first and last and always pseudo opcode.
Valid pseudoopcodes are:
~~~~~~~~~~~~~~~~~~~~~~~~
DC.x where x is one of [b] for byte
~~~~ [w] for word
[t] for triple (three bytes for 65816)
[l] for longword (as on 68000)
stores information in the objectcode. Bytes are all placed
like MC68000 format. MSB first LSB last.
[NOTE: Some other assemblers will handle this in another way!]
------------------------------------------------------------------------------
DCR.x where x is one of [b] for byte
~~~~~ [w] for word
[t] for triple (three bytes for 65816)
[l] for longword (as on 68000)
stores information in the objectcode. Bytes are all placed
like INTEL format. LSB first MSB last. To store 65C816 pointers
please use DCR.W or DCR.T.
[NOTE: Some other assemblers will handle this in another way!]
------------------------------------------------------------------------------
EQU assigns a constant value to a symbol. Symbol must NOT have
~~~ a colon (:) appended at the end. A symbol defined in this
way is NOT re-definable.
------------------------------------------------------------------------------
= same as EQU.
~
------------------------------------------------------------------------------
RSRESET resets the internal structure counter. See examples for
~~~~~~~ more information.
------------------------------------------------------------------------------
RS= sets the internal structure counter to a constant value.
~~~ See examples for more information.
------------------------------------------------------------------------------
RS.x assigns the internal structure counter to a symbol and advances
~~~~ the internal structure counter. See examples for more information.
------------------------------------------------------------------------------
DS.x <SIZ>,<V> creates a block of <SIZ> times a '.x' initialized with <V>.
~~~~~~~~~~~~~~ So DS.L 10,0 will create ten longwords of zero. Motorola
storage format is used. If you're more familar with the SEKA
syntax blk.x <size>,<value> please define a macro!
[NOTE: Some other assemblers will handle this in another way!]
------------------------------------------------------------------------------
DSR.x <SIZ>,<V> creates a block of <SIZ> times a '.x' initialized with <V>.
~~~~~~~~~~~~~~~ So DS.L 10,0 will create ten longwords of zero. Intel storage
format is used. If you're more familar with the SEKA syntax
blk[r].x <size>,<value> please define a macro!
format is used.
[NOTE: Some other assemblers will handle this in another way!]
------------------------------------------------------------------------------
SET assigns a constant value to a symbol. The symbol is able to be
~~~ redefined later on. So:
jackson set 25
jackson set jackson^2
just works great. You can use this to create default empty
OAM tables or even HDMA-window animations... (see examples)
------------------------------------------------------------------------------
IFD continues assembly upto next matching ELSE or ENDC only if the
~~~ following symbol is defined at assembly time. (Note a forward
reference means NOT DEFINED).
------------------------------------------------------------------------------
IFND continues assembly till next ELSE or ENDC only if the following
~~~~ symbol is not defined or a forward reference at assembly time.
------------------------------------------------------------------------------
IF continues assembly till next ELSE or ENDC only if the following
~~ expression returns TRUE. Valid terminals are:
= - equal
# - unequal
< - less than
> - greater than
For all calculations signed 32bit arithmetic is used.
------------------------------------------------------------------------------
ELSE inverses the last result of an IF statement and continues or
~~~~ dis-continues assembly till next ENDC.
------------------------------------------------------------------------------
ENDC ends conditional assembly.
~~~~
------------------------------------------------------------------------------
.REPEAT enables repetitive code generation.
~~~~~~~
.repeat n {
(....)
}
The code in brackets will be generated 'n' times. Please
remind 'n=0' will stop assembly with an errormessage. Since
i was to lame to solve the block structure. May be in the
future and when you request it from me and when at least
some people register, i'll include such goodies as FOR,
WHILE, UNTIL, LOOP and so on... lets see...
------------------------------------------------------------------------------
} ends a block structured command.
~
------------------------------------------------------------------------------
MACRO defines a MACRO definition. Parameters are allowed form
~~~~~ \1 upto \9. Parameters are textual replaced during macro
expansion. Call be name. Compiler builders love that. Anyway
we don't expand at runtime. Macro CALLS may be nested upto 128
times, however macro DEFINITIONS may NOT be nested. Also you
can generally use local labels and symbols by just adding
a '.' at the start of the labelname using a local symbol.
------------------------------------------------------------------------------
ENDM ends a macro definition.
~~~~
------------------------------------------------------------------------------
MODE will FORCE current MEMORY and/or INDEX sizes. Beware! Normally
~~~~ the code will generated as your rep&seps will say. So don't set
up the MEMORY and/or INDEX sizes by plp. If you do so, keep track
with MODE.
Warning: This pseudo opcode will not generate any code !!!
~~~~~~~
MODE A16X16 or A8X8 or A16X8 or A8X16 will do.
------------------------------------------------------------------------------
MEXIT during macro expansion, MEXIT will leave the current macro being
~~~~~ expanded. Usfull when using conditional assembly.
------------------------------------------------------------------------------
.BIN includes a binary file to the current objectposition. The
~~~~ current PC pointer is advanced in order to the length of the
binary file, both in LROM and in HROM mode.
Note: A 64k binary file will advance the PC by 64k in HROM mode
and by 128k in LROM mode.
------------------------------------------------------------------------------
.INCLUDE includes sourcecode. Includes may be nested upto 128 times.
~~~~~~~~
------------------------------------------------------------------------------
.PAD skips objectcode upto the next start of a bank. Blank area is
~~~~ filled with zero.
------------------------------------------------------------------------------
.SAY just simply prints the rest of the line to stout.
~~~~ '.say !' prints only a <CR>.
------------------------------------------------------------------------------
.ASK dumps usfull or not usfull data to stout.
~~~~
------------------------------------------------------------------------------
EXP= evaluates the expression following the '=' and prints the
~~~~ result to stout.
------------------------------------------------------------------------------
*= sets the current PC. Same as 'ORG'.
~~
------------------------------------------------------------------------------
ORG sets the current PC. Same as '*='.
~~~
------------------------------------------------------------------------------
EVEN aligns code on a word boundary. However, the WD65C816 does not
~~~~ expect your code word align'd like MC68000.
------------------------------------------------------------------------------
ODD aligns code on a (word+1) boundary.
~~~
------------------------------------------------------------------------------
HEAP defines maximum objectsize. MUST be the first command in your
~~~~ sourcecode, since HEAP also initializes lots of internal assembly
structures and hash tables.
HEAP O=1000 will allocate 1000 bytes
HEAP O=1000k will allocate 1000 kbytes
HEAP O=1000m will allocate 1000 mbytes
Don't forget: MUST be in your sourcecode.
------------------------------------------------------------------------------
LROM setup SASM to generate 32k banked code. This is the default
~~~~ setting.
------------------------------------------------------------------------------
HROM setup SASM to generate continous code. Like all those HI-ROM
~~~~ games use.
------------------------------------------------------------------------------
SYM+ enable dump of symboltable at the end of assembly. The
~~~~ dump could be interrupted vice versa CTRL-C.
------------------------------------------------------------------------------
SMC+ tell SASM to append a SuperMagicom or similar header. Works only
~~~~ if inital PC is $8000.
------------------------------------------------------------------------------
TEXT create TEXT as SNES SC data for direct load into VRAM of SNES.
~~~~ Usage is: TEXT attrbyte,"abcdef..", where attrbyte will be
the highbyte of all textbytes. Also <20H> is subtracted from
each character. SC information is stored <HIGH,LOW,HIGH,LOW...>
------------------------------------------------------------------------------
BASE <n> Assembles like PC set to <n>, but stores code at current
~~~~ position. BASE should be used only at the beginning of a new
bank, i could be done anywhere, but human mind can't follow
those strange things...
Usfull if you write routines, which have to run may be in WRAM
and which have to be copied by your code into other locations.
Example:
org $28000
base $1000
loop clc
inx
jmp loop
The code will be assembled with loop=$1000. So this piece of
assembly is only able to be executed when it's been copied down
to $1000 in WRAM (from location $28000).
------------------------------------------------------------------------------
DBUG tell SuperMagicom to enable 'GO-BACK' mode. Works only with
~~~~ SMC+ (needs header). Also a 'RESET-PULSE' will be send just
before sending the executable via POT1X in POTGO. (A $3000 is
written there pulling pin 5 of Gameport II up to 5V for a
second. Connect this one to reset in the SNES). Allowing to
return to SMC Menu software controlled by patching the
standart SMC fileheader. See resethandler.i also.
Recall: Please connect PIN 5 of gameport 2 to RESET of the
~~~~~~ SNES. RESET can be found at the RESET button. How true!
Make sure that you don't get ground or pullup! Ground
should be connected vice your parallel cable, if not
please connect it also. Work carefully! Don't blast
your SNES.
------------------------------------------------------------------------------
WARN prints a warning to stout. Please append warning text after warn.
~~~~ Also the warnings counter will be increased.
------------------------------------------------------------------------------
SIZE <n> does nothing, but accepts FASM v0.52 input. The function of
~~~~ this has been transfered to the HEAP command. Just to make
some difference to FASM.
------------------------------------------------------------------------------
For the commandline options please type SASM HELP. There're a lot of them....
Much fun!
Florian